﻿@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment HostingEnvironment
@{
    ErrorDetail errorDetail = ViewBag.ErrorDetail;
    string msg = errorDetail.Message;
    string obj = errorDetail.Object;
    string addtionalMsg = errorDetail.AdditionalMessage;
    string errorCode = errorDetail.Code;

    var icoUrl = "/error.ico" + "?random=" + new Random().Next();
    ShowTenantDto tenant = ViewBag.CurrentTenant;
    string tenantIcoUrl = "/favicon.ico";
    string tenantThumbnailUrl = "/images/no-thumbnail.png";
    string tenantImageUrl = "/images/no-image.png";
    string tenantShortName = "null";
    string tenantDescription = "null";
    if (tenant != null)
    {
        if (tenant.Id == "0")
        {
            tenantThumbnailUrl = "/images/tenant/logo.png";
            tenantImageUrl = "/images/tenant/trademark.png";
            tenantIcoUrl = "/images/tenant/ico.ico";
        }
        else
        {
            if (!tenant.ThumbnailPostfix.IsNullOrEmpty())
            {
                var fileName = "image" + tenant.ThumbnailPostfix;
                tenantThumbnailUrl = Url.Content("~/File/GetImage/Attachment/TenantThumbnail/" + tenant.Id) + "?fileName=" + (fileName) + "&random=" + new Random().Next();
            }
            if (!tenant.ImagePostfix.IsNullOrEmpty())
            {
                var fileName = "image" + tenant.ImagePostfix;
                tenantImageUrl = Url.Content("~/File/GetImage/Attachment/TenantImage/" + tenant.Id) + "?fileName=" + (fileName) + "&random=" + new Random().Next();
            }
            if (tenant.HasIco == 1)
            {
                var fileName = "ico.ico";
                tenantIcoUrl = Url.Content("~/File/GetImage/Attachment/TenantIco/" + tenant.Id) + "?fileName=" + (fileName) + "&random=" + new Random().Next();
            }
        }
        tenantShortName = tenant.ShortName.IsNullOrEmpty() ? "Undefined" : tenant.ShortName;
        tenantDescription = tenant.Description.IsNullOrEmpty() ? "Undefined" : tenant.Description;
    }
}

<script type="text/javascript" src='@Url.Content("/lib/jquery/2.1.4/jquery.min.js")'></script>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>错误消息</title>
    <link rel="shortcut icon" href="@Url.Content("~"+icoUrl)" type="image/x-icon" />
    <link rel="stylesheet" href='@Url.Content("~/lib/bootstrap/3.3.7/css/bootstrap.min.css")'>
    <link rel="stylesheet" href='@Url.Content("~/lib/fontawesome/4.7.0/css/fontawesome.min.css")'>

    @BundlerHelper.Render(HostingEnvironment.ContentRootPath, Url.Content("~/app/site/css/site.min.css"))
    @BundlerHelper.Render(HostingEnvironment.ContentRootPath, Url.Content("~/app/site/css/" + "site-theme.min.css"))
</head>

<body>
    <header id="err-header" class="header-background" style="height: 48px;">
        <div class="layout-header header-background" style="height: 48px;">
            <img alt="image" src='@tenantThumbnailUrl' class="img-circle" style="float:left; margin: 5px; height: 38px" />
            <div style="margin-left: 50px; margin-top: 2px;height: 50px;text-align: left;font-size: 16px;line-height: 50px;color: #fff">
                <span>@tenantShortName</span><span style="font-size: 13px;font-weight:200">&nbsp;&nbsp;@tenantDescription</span>
            </div>
        </div>
    </header>
    <div class="msg-container">
        <div class="msg-wrapper">
            <div>
                <img alt="image" src='~/images/stop.png' class="img-circle image-left" height="38" width="38" />
            </div>
            <div style="text-align: left; padding-left:40px;margin-top: 1px">
                <span class="msg error">@msg</span>
                @if (!obj.IsNullOrEmpty())
                {
                    <span> <span class="error">Object: </span>@obj</span>
                }
                @if (!errorCode.IsNullOrEmpty())
                {
                    <span>; <span class="error">ErrCode: </span> @errorCode</span>
                }

            </div>
            <div style="text-align: left; padding-left:40px;padding-left:40px; margin-top: 10px">
                @if (!addtionalMsg.IsNullOrEmpty())
                {
                    <span class="addl-msg">@addtionalMsg</span>
                }
            </div>
        </div>
    </div>
</body>
</html>

<script>
    $(function () {
        removeHeader();
    });

    function removeHeader() {
        if (self != top) {
            $("#err-header").remove();
        }
        else {
        }
    }
</script>

<style>
    .msg-container {
        padding: 30px 30px 80px;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: #f3f3f4;
    }

    .msg-wrapper {
        width: 800px;
        height: 100px;
    }

    .error {
        color: red;
    }

    .image-left {
        float: left;
    }

    .msg {
        font - weight: 400;
        font-size: 28px;
    }

    .addl-msg {
        color: red;
        /*        font-weight: 400;*/
        font-size: 15px;
    }
</style>


